#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //获取文本输入框内容
    QString lineText =  ui->lineEdit->text();
    //设置文本输入框的编辑模式
    // ui->lineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);

    //设置文本输入框内容
    ui->lineEdit->setText("HelloWorld!");
    qDebug ()<<lineText;

    QStringList stringList;
    stringList<<"h1"<<"Hello"<<"World"<<"demo"<<"text"<<"abcd"<<"test";

    //设置文本输入框的匹配项
    QCompleter* qComplete = new QCompleter(stringList,this);
    qComplete->setCaseSensitivity(Qt::CaseInsensitive);
    ui->lineEdit->setCompleter(qComplete);
    //1.Label显示文本
    ui->labelText->setText(QString("labelText"));
    qDebug()<<ui->labelText->text();
    //2.Label显示图片
    ui->labelImage->setPixmap(QPixmap(":/new/prefix1/ico/FauxS-X (Cobalt) Icon 56.ico"));
    //ui->labelImage->setScaledContents(true);
    //3.Label显示Gif动画
    QMovie* qmovie = new QMovie((":/new/prefixGif/gif/gif003.gif"));
    ui->labelGif->setMovie(qmovie);
    qmovie->start();
    ui->labelGif->setScaledContents(true);
    //4.Label显示网页超链接
    ui->labelUrl->setText("<a href='https://www.baidu.com'>百度一下</a>");
    ui->labelUrl->setOpenExternalLinks(true);

    //水晶管
    ui->lcdNumber->display("789");

    ui->progressBar->setMaximum(500);
    ui->progressBar->setMinimum(0);
    ui->progressBar->setValue(0);
}

MainWindow::~MainWindow()
{
    delete ui;
}
